package com.hugo.maomi_first.home.presenter;

import com.hugo.maomi_first.Interface.OnLoadHomeGoodsListener;
import com.hugo.maomi_first.Interface.OnLoadHomeHeaderListener;
import com.hugo.maomi_first.bean.HomeGoodsBean;
import com.hugo.maomi_first.bean.HomeHeaderBean;
import com.hugo.maomi_first.home.model.HomeModelImpl;
import com.hugo.maomi_first.home.model.IHomeModel;
import com.hugo.maomi_first.home.view.IHomeView;

/**
 * Created by Administrator on 2016/6/26.
 */
public class HomePresenterImpl implements IHomePresenter {
    private static final String TAG = "HomePresenterImpl";
    private IHomeView view;
    private IHomeModel model;

    public HomePresenterImpl(IHomeView view) {
        this.view = view;
        this.model = new HomeModelImpl();
    }

    @Override
    public void loadHomeHeader() {
        model.loadHomeHeader(new OnLoadHomeHeaderListener() {
            @Override
            public void onSuccess(HomeHeaderBean.DataBean bean) {
                view.loadHomeHeader(bean);
            }

            @Override
            public void onFailure() {

            }
        });
    }

    @Override
    public void loadHomeGoods() {
        model.loadHomeGoods(new OnLoadHomeGoodsListener() {
            @Override
            public void onSuccess(HomeGoodsBean bean) {
                view.loadHomeGoods(bean);
            }

            @Override
            public void onFailure() {

            }
        });
    }

}
